package cn.edu.day02;

public class Test {
    public static void main(String[] args) throws Exception{
        String str="127.123.0.1";
        String regex="^\\d{1,3}.{1}\\d{1,3}.{1}\\d{1,3}.{1}\\d{1,3}$";
        System.out.println("127.123.0.1".matches(regex));
        if (str.matches(regex))
        {
            String strs []=str.split("\\.",1);
            for(String s:strs)
            {
                System.out.println(s);
            }
        }
        else{
            System.out.println("当前字符串不是IP地址");
        }
    }
}
